package edu.yngsxy.wkstudy.core.sys.service;

import edu.yngsxy.wkstudy.core.model.dto.LoginDTO;
import edu.yngsxy.wkstudy.core.model.dto.RegisterDTO;
import edu.yngsxy.wkstudy.core.model.dto.SysUserDTO;
import edu.yngsxy.wkstudy.core.service.WkBaseService;
import edu.yngsxy.wkstudy.core.sys.model.entity.SysUser;
import org.springframework.data.repository.query.Param;

import java.util.function.Consumer;

/**
 * <p>
 * 用户：存储系统用户信息 服务类
 * </p>
 *
 * @author qyc
 * @since 2025-08-30
 */

public interface SysUserService extends WkBaseService<SysUser> {
    /**
     * 注册用户
     * @param user
     * @param beforeSaveCallback 保存前回调函数
     */
    public SysUser register(RegisterDTO user, Consumer<SysUser> beforeSaveCallback);
    public SysUser findByUsername(String username);
    public SysUser findByEmail(String email);
    public SysUser login(LoginDTO loginDTO);
    /**
     * 根据用户ID查询用户信息（包含角色和权限列表）
     * @param userId 用户ID
     * @return 用户实体
     */
    SysUserDTO selectWithRolePermissionByUserId(@Param("userId") Long userId);

}
